package com.first.hms.service;

import com.first.hms.entity.Order;
import com.first.hms.mapper.OrderMapper;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

/**
 * 订单服务 (OrderService)
 * 方法：
 * addOrder(Order order)： 创建订单（预定房间）
 * updateOrder(Order order):取消订单、办理入住（更新订单状态）、退房处理
 * selectOrders(String ddbh)：查询用户订单、财务分析*/
@Service
public class OrderService {
    @Autowired
    private OrderMapper orderMapper;

    public int addOrder(Order order)
    {
        return orderMapper.addOrder(order);
    }

    public int updateOrder(Order order)
    {
        return orderMapper.updateOrder(order);
    }


    public ArrayList<Order> selectOrdersByUser(String grbh)
    {
        return orderMapper.selectOrdersByUser(grbh);
    }

    public ArrayList<Order> selectOrdersByStatus(String ddzt)
    {
        return orderMapper.selectOrdersByStatus(ddzt);
    }

    public Order selectOrder(String ddbh)
    {
        return orderMapper.selectOrder(ddbh);
    }


}
